home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Business Master (3rd Edition)
/
The Business Master (3rd Edition).iso
/
files
/
comphelp
/
begin6pk
/
chapt2
< prev
next >
Wrap
Text File
|
1993-02-20
|
7KB
|
193 lines
CHAPTER 2
INTRODUCTION TO COLOR CODES
Two Easy Steps To A World Of Color
Having a color monitor takes advantage of the color codes
provided by the MS-DOS disk. These simple-to-learn codes
will spark life into programs that you write and provide as
many as 64 color combinations "free," just by typing a few short
color codes.
In the next sections, you will be creating color
combinations and Menus that will contain Speed Keys. When
creating these Menus you will also be adding a different color
combination to each one.
WHAT YOU WILL LEARN IN THIS CHAPTER
Ansi Escape Codes For Color
How To Use These Codes
HOW TO GET STARTED WITH COLOR
STEP 1.
You must copy from the MS-DOS disk a file called Ansi.Sys.
This file takes your color codes and adapts them so that your
color monitor can use them.
The next step is to store Ansi.Sys in a special file called
Config.Sys so that it will be available to DOS when the
computer is turned on.
STEP 2.
The Ansi.Sys file must be stored in the Config.Sys file as
outlined on the next page. With this accomplished you will
have the necessary components to run the color codes and
have color appear on your color monitor.
You start by copying the Ansi.Sys file from the DOS disk
as follows:
Insert the MS-DOS into the Computer.
Next to the A> Prompt, type the following:
Copy Ansi.Sys B: <Press the Enter key.>
Follow the DOS prompts. Insert your disk when requested.
A copy of the Ansi.Sys file from MS-DOS disk will be transferred
to your disk.
One More Step
Leave your disk in the computer.
In this next step, you are going to create a Config.Sys file
in which you will put your Ansi.Sys command.
To do this: type the following next to the A> Prompt, like this:
Copy Con Config.Sys
Device=Ansi.Sys
Press F6 key ....Then press <Enter> key to end the file.
------------
That's all there's to it!
You now have the two files you need to get color.
-6-
The ANSI Color Escape Sequences
The word ANSI stands for the "American National
Standards Institute" which developed these codes.
Below is a copy of the color Escape codes for setting
color to the background and letters.
These codes are called the ANSI Escape Codes,
or Sequences for setting the foreground
(letters or text) and background colors. Type as indicated.
Don't use capital letters for the code.The Escape Code
always starts:
With a Dollar Sign ($)
A Small (e)
A Left Bracket ([ )
And ends with the small letter (m)
All of the above parameters are used on the next page.
SPECIAL ATTRIBUTE COMMANDS
$e[0m Normal, white on black
$e[1m Bold, high intensity
$e[4m Underline if available
$e[5m Blink
$e[7m Reverse video
These five commands are called attribute commands.
They let you control the brightness, blinking and reverse video.
THE COLOR CODES
$e[30m black letters $e[40m black background
$e[31m red letters $e[41m red background
$e[32m green letters $e[42m green background
$e[33m yellow letters $e[43m yellow background
$e[34m blue letters $e[44m blue background
$e[35m magenta letters $e[45m magenta background
$e[36m cyan letters $e[46m cyan background
$e[37m white letters $e[47m white background
The group of Ansi codes list 8 colors for the letters
and 8 colors for the background. Simple math shows
that 8 x 8 =64. Therefore, we have 64 possible
color combinations.
HOW TO USE THESE COLOR CODES
There are a few simple rules you must follow if you want the
color codes to work:
▀ You must always start with the word "Prompt".
▀ Then the dollar sign, as the first entry after Prompt.
▀ Then the small e (Yes, you can use a capital E here.)
▀ Then the left bracket.
▀ End with a small m. (small m, please)
▀ Escape sequences may be combined by putting a
semicolon after each item.
YOUR FIRST ENTRY WILL BE TO CHANGE THE
Screen Color to Black and White.
-7-
To do this, type the following next to the A> Prompt, like
this:
Prompt $e[0m $p$g
<Press the Enter key.>
The $e[0m is the code to reverse all colors to black and
white. This is known as reverse video. Your screen will
remain black and white until you add some of your own
color or use a commercial program that has its own color
program, or restart your computer.
You should now have your original black and white
colors on your screen. If you still have color on your screen,
recheck the way you entered the Ansi Escape codes.
It is important that you type the codes exactly as shown.
Make certain that:
▀ The first word is "Prompt. Prompt
▀ The second word is the dollar sign ($). Prompt $
▀ The third word is the small (e). Prompt $e
▀ The next, the left bracket ( [ ) Prompt $e[
▀ Then the code number Prompt $e[7m
▀ Finally,next to the code type $p$g Prompt $e[7m $p$g
The $p$g gives you this subdirectory prompt A:\>.
When you type Escape codes and can't get any color change
on the screen, you must restart (boot) your computer to
enter these new escape commands into the computer's
"memory."
Press Esc key to return to Menu
GO TO CHAPTER 3 "Color Combinations"
-8-